#ifndef _SMP_EXTABWND_H
#define _SMP_EXTABWND_H

#include "sgl_funcs.h"
#include "sgl_window.h"
#include "smp.h"
#include "smp_tabwindow.h"
#include "res.h"


enum {
	SMP_EXTABWND_ADDTAB,
	SMP_EXTABWND_REMOVETAB,
	SMP_EXTABWND_SETTABBYINDEX,
	SMP_EXTABWND_SETACTIVETABBYINDEX,
	SMP_EXTABWND_GETTABBYID,
	SMP_EXTABWND_GETTABBYINDEX,
	SMP_EXTABWND_SETACTIVETABBYID,
	SMP_EXTABWND_GETACTIVETABINDEX,
	
	//,SMP_TABWINDOW_WNDPROC
	
	SMP_EXTABWND_MAX
};

#ifndef SDK_NO_PLUGIN
#define SMP_EXTABWND_WNDPROC  		MPS_CODE_SMP_EXTABWND_PROC
#define SMP_EXTAB_TABBAR_WNDPROC  	MPS_CODE_SMP_EXTAB_TABBAR_PROC
#else
#define SMP_EXTABWND_WNDPROC  		SMP_ExTabWnd_WndProc
#define SMP_EXTAB_TABBAR_WNDPROC  	SMP_TabBar_WndProc
#endif



#define SMP_EXTABWND_TABCOUNT			10

	/**
	 * \name Window Member Functions
	 * @{
	 */

#if defined(INCLUDE_IN_PLUG_SGL_SRC) || defined(SDK_NO_PLUGIN)
/**
 * \brief Add a tab window
 *
 * \param hWnd the tab window handle
 * \param bmp the icon id
 * \param title the child tab window title
 * \param hTab the  child window handle
 */
int32 SMP_ExTabWnd_AddTab(HWND hWnd, bmpSt* icon,bmpSt* hicon,HWND hTab);

/**
 * \brief Remove a tab
 *
 * \param hWnd the tab window handle
 * \param id the child tab window id
 */
int32 SMP_ExTabWnd_RemoveTab(HWND hWnd, WID id);

/**
 * \brief 
 *
 * \param hWnd the tab window handle
 */
int32 SMP_ExTabWnd_SetTabByIndex(HWND hWnd, Sint32 index, HWND hTab);


/**
 * \brief Set the tab of index as the active tab
 *
 * \param hWnd the tab window handle
 * \param index the child window index
 */
int32 SMP_ExTabWnd_SetActiveTabByIndex(HWND hWnd, Sint32 index);

/**
 * \brief Get the tab child window by id
 *
 * \param hWnd the tab window handle
 * \param id the child tab window id
 * \return the child tab window handle
 */
HWND SMP_ExTabWnd_GetTabByID(HWND hWnd, WID id);

HWND SMP_ExTabWnd_GetTabByIndex(HWND hWnd, Sint32 index);

/**
 * \brief Set the tab with id as the active tab.
 *
 * \param hWnd the tab window handle
 * \param id the child window handle
 */
int32 SMP_ExTabWnd_SetActiveTabByID(HWND hWnd, WID id);

/**
 * \brief Get the active tab index
 *
 * \param hWnd the tab window handle
 * \return the active tab index
 */
Sint32 SMP_ExTabWnd_GetActiveTabIndex(HWND hWnd);

	/** @} */

	/**
	 * \name Window Procedure
	 * @{
	 */

/**
 * \brief The simple tab window procedure.	
 *
 * \param hWnd the tab window handle
 * \param Msg the window message
 * \param wParam the first parameter
 * \param lParam the second parameter
 * \return the result of message process 
 */
LRESULT SMP_TabBar_WndProc(HWND hTab, UINT Msg, WPARAM wParam, LPARAM lParam);
	
LRESULT SMP_ExTabWnd_WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);

#else
/**
 * \brief Add a tab window
 *
 * \param hWnd the tab window handle
 * \param bmp the icon id
 * \param title the child tab window title
 * \param hTab the  child window handle
 */
#define SMP_ExTabWnd_AddTab(hWnd, icon,hicon, hTab) \
	mrc_extSendAppEventEx(MPS_CODE_SMP_EXTABWND, SMP_EXTABWND_ADDTAB, (int32)hWnd, (int32)icon, (int32)hicon, (int32)hTab, (int32)0)

/**
 * \brief Remove a tab
 *
 * \param hWnd the tab window handle
 * \param id the child tab window id
 */
#define SMP_ExTabWnd_RemoveTab(hWnd, id) \
	mrc_extSendAppEventEx(MPS_CODE_SMP_EXTABWND, SMP_EXTABWND_REMOVETAB, (int32)hWnd, (int32)id, (int32)0, (int32)0, (int32)0)

/**
 * \brief Remove all the tabs
 *
 * \param hWnd the tab window handle
 */
#define SMP_ExTabWnd_SetTabByIndex(hWnd, index, hTab) \
	mrc_extSendAppEventEx(MPS_CODE_SMP_EXTABWND, SMP_EXTABWND_SETTABBYINDEX, (int32)hWnd, (int32)index, (int32)hTab, (int32)0, (int32)0)


/**
 * \brief Set the tab of index as the active tab
 *
 * \param hWnd the tab window handle
 * \param index the child window index
 */
#define SMP_ExTabWnd_SetActiveTabByIndex(hWnd, index) \
	mrc_extSendAppEventEx(MPS_CODE_SMP_EXTABWND, SMP_EXTABWND_SETACTIVETABBYINDEX, (int32)hWnd, (int32)index, (int32)0, (int32)0, (int32)0)

/**
 * \brief Get the tab child window by id
 *
 * \param hWnd the tab window handle
 * \param id the child tab window id
 * \return the child tab window handle
 */
#define SMP_ExTabWnd_GetTabByID(hWnd, id) \
	(HWND)mrc_extSendAppEventEx(MPS_CODE_SMP_EXTABWND, SMP_EXTABWND_GETTABBYID, (int32)hWnd, (int32)id, (int32)0, (int32)0, (int32)0)

#define SMP_ExTabWnd_GetTabByIndex(hWnd, index) \
	(HWND)mrc_extSendAppEventEx(MPS_CODE_SMP_EXTABWND, SMP_EXTABWND_GETTABBYINDEX, (int32)hWnd, (int32)index, (int32)0, (int32)0, (int32)0)

/**
 * \brief Set the tab with id as the active tab.
 *
 * \param hWnd the tab window handle
 * \param id the child window handle
 */
#define SMP_ExTabWnd_SetActiveTabByID(hWnd, id) \
	mrc_extSendAppEventEx(MPS_CODE_SMP_EXTABWND, SMP_EXTABWND_SETACTIVETABBYID, (int32)hWnd, (int32)id, (int32)0, (int32)0, (int32)0)

/**
 * \brief Get the active tab index
 *
 * \param hWnd the tab window handle
 * \return the active tab index
 */
#define SMP_ExTabWnd_GetActiveTabIndex(hWnd) \
	(Sint32)mrc_extSendAppEventEx(MPS_CODE_SMP_EXTABWND, SMP_EXTABWND_GETACTIVETABINDEX, (int32)hWnd, (int32)0, (int32)0, (int32)0, (int32)0)

	/** @} */

	/**
	 * \name Window Procedure
	 * @{
	 */

/**
 * \brief The simple tab window procedure.	
 *
 * \param hWnd the tab window handle
 * \param Msg the window message
 * \param wParam the first parameter
 * \param lParam the second parameter
 * \return the result of message process 
 */
#define SMP_TabBar_WndProc(hWnd, Msg, wParam, lParam) \
	(LRESULT)mrc_extSendAppEventEx(MPS_CODE_SMP_EXTAB_TABBAR_PROC, (int32)hWnd, (int32)Msg, (int32)wParam, (int32)lParam, (int32)0, (int32)0)

#define SMP_ExTabWnd_WndProc(hWnd, Msg, wParam, lParam) \
	(LRESULT)mrc_extSendAppEventEx(MPS_CODE_SMP_EXTABWND_PROC, (int32)hWnd, (int32)Msg, (int32)wParam, (int32)lParam, (int32)0, (int32)0)
#endif
	
	/** @} */

/** @} end of smp_tabwindow */


#endif

